﻿using System;
using System.Threading.Tasks;

namespace BASIC_CORE.Domain.Caching.Repositories
{
    /// <summary>
    /// 锁分发仓储
    /// </summary>
    public partial interface IDistributeLockCacheRepository
    {
        /// <summary>
        /// 缓存获取特定标识是否存在于缓存中
        /// </summary>
        /// <param name="lockId"></param>
        /// <returns></returns>
        bool IsExistLockedId(string lockId);

        /// <summary>
        /// 缓存获取特定标识是否存在于缓存中
        /// </summary>
        /// <param name="lockId"></param>
        /// <returns></returns>
        object GetObject(string lockId);

        /// <summary>
        /// 将特定标识加入到缓存中
        /// </summary>
        /// <param name="lockId"></param>
        void SetLockedId(string lockId);

        /// <summary>
        /// 将特定标识加入到缓存中
        /// </summary>
        /// <param name="lockId"></param>
        /// <param name="timeSpan"></param>
        void SetLockedId(string lockId, TimeSpan timeSpan);

        /// <summary>
        /// 将特定标识移除缓存
        /// </summary>
        /// <param name="lockId"></param>
        void RemoveLockedId(string lockId);
    }
}
